<template>
  <view>
    <view class="fanhui" @click="fanhui">
      <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/fanhui.png"></image>
    </view>
    <ji-gif v-if="is_ji_gif"></ji-gif>
    <login v-if="is_login" v-on:x="no_login" v-on:plogin="to_login"></login>
    <video v-if="donghua.video" class="ba-video" autoplay="true" loop="true"
           src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/beijing.mp3"></video>
    <!-- 通知 -->
    <view v-for="(item,index) in message_list" v-if="donghua.message_list && index==message_index" class="message">
      <image :src="message_list[message_index].avatar"></image>
      <text>{{ message_list[message_index].content }}</text>
    </view>
    <!-- 背包鸡蛋 -->
    <view class="beibao" :style="'z-index:'+yindao_z_index[2]">
      <view class="img">
        <image :src="member_info.avatar"></image>
      </view>
      <view class="beijing">
        <view class="jidan-yiyou">{{ ji_info.chicken_info.eggs }}</view>
        <view @click="huanjidan" class="lingqu">换鸡蛋</view>
      </view>
    </view>
    <!-- 攻略 -->
    <view class="gonluen" @click="show_renwu(1)">
      <view class="img">
        <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/gonglue.png"></image>
      </view>
      <view class="gonluen-msg">攻略</view>
    </view>
    <!-- 春节福袋 -->
    <view v-if="ji_info.sanshi_status==1" class="fudai" @click="to('/yangji/activity/index')">
      <image mode="widthFix" src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/fudai.gif"></image>
    </view>
    <!-- 音频 -->
    <view class="video-yin" @click="donghua.video=!donghua.video">
      <image v-if="donghua.video" src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/t_video.png"></image>
      <image v-if="!donghua.video"
             src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/f_video.png"></image>
    </view>
    <!-- 菜单 -->
    <view class="caidan">
      <!-- 好友 -->
      <view class="haoyou" :style="donghua.yindao?'opacity: 0.5;':''" @click="get_user_list">
        <view class="img">
          <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/haoyou.png"></image>
        </view>
        <view class="gonluen-msg">好友</view>
      </view>
      <!-- 道具 -->
      <view @click="donghua.daoju=!donghua.daoju" :style="donghua.yindao?'opacity: 0.5;':''" class="haoyou siliao">
        <view class="img">
          <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/daoju.png"></image>
        </view>
        <view class="gonluen-msg daoju-text">道具</view>
      </view>
      <!-- 饲料 -->
      <view @click="show_renwu(2)" :style="donghua.yindao?yindao_index==3?'opacity: 1;':'opacity: 0.5;':''"
            class="haoyou siliao">
        <view class="img">
          <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/lingsiliao.png"></image>
        </view>
        <view class="gonluen-msg">领饲料</view>
      </view>
    </view>

    <!-- 喂饲料 -->
    <view @click="weisiliao" :style="'z-index:'+yindao_z_index[0]" class=" wei-siliao">
      <!-- <ar-circle-progress borderWidth="10" activeColor="#fbac37" width="120" :percent="percent"> -->
      <view class="siliao-img">
        <image mode="widthFix"
               src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/yousiliaofanpen.png"></image>
        <view class="gonluen-msg">{{ ji_info.chicken_info.fodder }}g</view>
      </view>
      <!-- </ar-circle-progress> -->
    </view>
    <!-- 饭盆 -->
    <view :class="donghua.fanpen?'fanpen fanpen-donghua':'fanpen'" v-if="ji_info.jinshi_info.is_over==1">
      <image mode="widthFix" src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/kongpen.png"></image>
    </view>
    <!-- 泡泡 -->
    <view class="paopao">
      <view class="xingqing-text">心情</view>
      <view class="xingping">
        <image mode="widthFix" src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/xinping.png"></image>
      </view>
      <view class="paopao-msg">{{ ji_info.chicken_info.emotion_value }}</view>
    </view>
    <view class="baj">
      <!-- 眨眼小鸡 -->
      <view v-if="ji_info.jinshi_info.is_over==1" @click="set_motou" class="moutou ji">
        <!-- 话术 -->
        <view v-if="donghua.message" class="hua-message">
          {{ t_message }}
        </view>
      </view>
      <!-- 吃饭小鸡 -->
      <view @click="set_motou" v-if="ji_info.jinshi_info.is_over==0" class="chishi-ji ji">
        <!-- 话术 -->
        <view v-if="donghua.message" class="hua-message">
          {{ t_message }}
        </view>
      </view>
      <!-- 鸡粑粑 -->
      <view v-if="ji_info.chicken_info.self_is_qingjifen==0" @click="del_ji_baba()"
            :class="donghua.baba?'jibaba jibaba-donghua':'jibaba'">
        <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/bianbian.png"></image>
      </view>
      <!-- 正在下的鸡蛋 -->
      <view @click="jiwu" :style="'z-index:'+yindao_z_index[1]" class="jiwu">
        <view class="jiwu-text" v-if="ji_info.chicken_info.basket_eggs">{{ ji_info.chicken_info.basket_eggs }}</view>
        <image class="jidan" src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/jidian.png"></image>
        <image class="jiwu-img" src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/jiwo.png"></image>
        <view class="jindutiao">
          <view class="jindu" :style="'width:'+ji_info.chicken_info.grow_value+'%'"></view>
          <view class="msg">{{ ji_info.chicken_info.grow_value }}%</view>
        </view>
        <view v-if="donghua.jidan" class="jidan-donghua">
          <image class="jidan" src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/jidan.png"></image>
        </view>
      </view>
      <!-- 正在吃饭的鸡 -->
      <view v-if="ji_info.jinshi_info.is_over==0" class="chi-fan">
        <image mode="widthFix" class="chi-fanpen"
               src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/yousiliaofanpen.png">
        </image>
        <view class="jindu">
          {{ ji_info.jinshi_info.end_time_shifen }}
          <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/shijian.png"></image>
        </view>
      </view>

    </view>
    <!-- 任务 -->
    <view :class="renwu_show?'renwu renwu_donghua':'renwu'">
      <view class="renwu-list">
        <view class="top">
          <text v-if="is_show_renwu==2">饲料任务</text>
          <text v-if="is_show_renwu==1">攻略</text>
        </view>
        <view @click="show_renwu(0)" class="top-icon-x">
          <uni-icons type="closeempty" color="#fff"></uni-icons>
        </view>
        <view v-if="is_show_renwu==2 && item.status>0" class="renwu-item" :style="'z-index:'+yindao_z_index[index+3]"
              v-for="(item,index) in renwu_list">
          <view class="item-info">
            <view class="item-img">
              <image :src="item.icon"></image>
            </view>
            <view class="item-title">{{ item.name }}</view>
          </view>
          <view class="item-set">
            <view v-if="item.msg" class="item-text">已完成
              <text>{{ item.msg }}</text>
            </view>

            <view @click="renwu(index)" class="item-button" v-if="item.is_show && index!=0">进入</view>
            <view @click="qiandao" class="item-button" v-if="item.is_show && index==0">签到</view>
            <view class="item-button" id="yiqiandao" v-if="!item.is_show && index==0">已签到</view>
            <view class="item-button" id="yiqiandao" v-if="!item.is_show && index!=0">已完成</view>
          </view>
        </view>
        <view class="gonlue-com" v-if="is_show_renwu==1" style="height: 100%;overflow-y: auto;">
          <p v-for="(item,index) in ji_info.huashu_gonglue.yangjigonglue">{{ index + 1 }}、{{ item.content }}</p>
        </view>
      </view>
    </view>
    <!-- 道具 -->
    <view :class="donghua.daoju?'renwu renwu_donghua daoju':'renwu daoju'">
      <view class="renwu-list">
        <view class="top">
          <text v-if="is_show_renwu==2">饲料任务</text>
          <text v-if="is_show_renwu==1">攻略</text>
        </view>
        <view @click="show_renwu(4)" class="top-icon-x">
          <uni-icons type="closeempty" color="#fff"></uni-icons>
        </view>
        <view class="daoju-title">我的道具</view>
        <view :class="ji_info.chicken_info.speed_card<=0?'daoju-jiasu-ba huise':' daoju-jiasu-ba'">
          <view class="daoju-jiasu-nei-ba">
            <view class="daoju-icon">
              <view class="daoju-icon-img">
                <image
                    :src="ji_info.chicken_info.speed_card<=0?'https://wechat-pictures-1301970825.file.myqcloud.com/yangji/jiasukahuise.png':'https://wechat-pictures-1301970825.file.myqcloud.com/yangji/jiasu.png'"></image>
              </view>
              <view class="daoju-icon-msg">{{ ji_info.chicken_info.speed_card }}</view>
            </view>
            <view class="daoju-info">
              <view class="daoju-info-title">加速卡</view>
              <view class="daoju-info-msg">使用后，进食时间减少一小时。</view>
              <view class="daoju-info-button" @click="daoju">使用</view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <!-- 食物 -->
    <view v-if="donghua.jishi" class="shiwu"></view>
    <!-- 铲子 -->
    <view v-if="donghua.chanshi" class="chanshi">
      <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/chanzi.png"></image>
    </view>
    <!-- 好友列表 -->
    <view v-if="donghua.user_list" :class="donghua.user_list?'user-list user-list-donghua':'user-list' ">
      <view class="user-item" v-for="(item,index) in user_list.friend_list" @click="to_userjichang(index)">
        <view class="user-img">
          <view class="chanzi-icon" v-if="item.is_help==0">
            <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/chanzi.png"></image>
          </view>

          <image :src="item.avatar"></image>
        </view>
        <view class="user-name">{{ item.nick_name }}</view>
      </view>
    </view>
    <view v-if="donghua.user_list" @click="donghua.user_list=!donghua.user_list" class="zhezhao"></view>
    <view v-if="renwu_show" @click="show_renwu(0)" class="zhezhao"></view>
    <view v-if="donghua.daoju" @click="donghua.daoju=!donghua.daoju" class="zhezhao"></view>
    <!-- 攻略 -->
    <view v-if="donghua.yindao" class="gonluen-yindao"></view>
    <view v-if="donghua.yindao" class="gonglue" @click="yindao">
      <!-- 第一步 -->
      <view class="gonglue-index" v-if="yindao_index==-1">
        <view class="tishi">
          <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/yindaoye/yingdaoyangji.png"></image>
          <view class="huashu">欢迎您第一次进入游戏，下面由我为你进行指引。</view>
        </view>
        <view class="gonglue-button">下一步</view>
      </view>
      <!-- 第二步 喂食 -->
      <view class="gonglue-index" v-if="yindao_index==0">
        <image class="weishi-image"
               src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/kongpen.png"></image>
        <view class="tishi weishi">
          <view class="huashu">欢迎您第一次进入游戏，下面由我为你进行指引。</view>
        </view>
        <image class="yindao-icon"
               src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/yindaoye/siliaojiantou.png"></image>
      </view>
      <!-- 第三步 鸡蛋进度条 -->
      <view class="gonglue-index" v-if="yindao_index==1">
        <view class=" jidanjinshi">
          <view class="huashu">吃饲料的过程会积累鸡蛋养成进度，进度满100就能产下一枚鸡蛋了呢</view>
        </view>
        <image class="jidian-icon"
               src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/yindaoye/yangjidianjiantou.png"></image>
        <view class="jidian-button">下一步</view>
      </view>
      <!-- 第三步篮子里的鸡蛋 -->
      <view v-if="yindao_index==2" class="">
        <view class="lanzi-text">集齐指定鸡蛋可以到店内兑换鸡蛋的哦。</view>
        <view class="jidian-button lanzi-button">下一步</view>
        <image class="lanzi-icon"
               src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/yindaoye/jidianjiantou.png"></image>
      </view>
      <!-- 第四步 领取饲料 -->
      <view v-if="yindao_index==3">
        <view class="lanzi-text siliao-text">主人，没粮了，让我们完成几个任务储备些饲料吧。</view>
        <image class="siliao-icon"
               src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/yindaoye/siliaojiantou.png"></image>
      </view>
      <!-- 第一步 -->
      <view class="gonglue-index" v-if="yindao_index==4">
        <view class="tishi">
          <image src="https://wechat-pictures-1301970825.file.myqcloud.com/yangji/yindaoye/yingdaoyangji.png"></image>
          <view class="huashu">恭喜你已看完所有引导。</view>
        </view>
        <view class="gonglue-button">开始游戏</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      moutou: false,
      count: 0,
      left: '50%',
      message_count: 1,
      percent: 0,
      renwu_show: false,
      ji_info: {}, //鸡的信息
      message_list: [], //消息
      message_index: 0,
      donghua: {
        jishi: false,
        fanpen: false,
        chanshi: false,
        baba: false,
        message: false,
        user_list: false,
        yindao: false,
        daoju: false,
        jidan: false,
        message_list: false,
        video: true
      },
      t_message: "",
      user_list: [],
      renwu_list: [],
      yindao_z_index: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
      yindao_index: -1,
      is_login: false,
      member_info: uni.getStorageSync("member_info"),
      is_show_renwu: "",
      style: false,
      jiasuka_status: true,
      is_ji_gif: true,
      diandianle_message: "",
      tongbu_ji_status: ""

    }
  },
  onShareAppMessage() {

  },
  onShow() {
    this.style = "";
    this.message();
    this.get_ji(); //获取鸡的信息
    // this.get_renwu_cofing();//获取任务配置信息
    if (uni.getStorageSync("token")) { //登录判断
      this.is_login = false;
    } else {
      this.is_login = true;
    }
    //教程显示
    if (!uni.getStorageSync("yangji_yindao")) {
      this.donghua.yindao = true;
    }
  },
  onLoad(e) {
    if (e.title) {
      this.diandianle_message = e.title;
    }
    this.tongbu_ji()
  },
  methods: {
    to_login() {
      this.is_login = false;
      this.message();
      this.get_ji(); //获取鸡的信息
      // this.get_renwu_cofing();//获取任务配置信息
    },
    //弹出任务
    show_renwu(type) {
      if (type == 4) {
        this.donghua.daoju = !this.donghua.daoju
      } else {
        if (type == 2) {
          this.get_renwu_cofing();
        }
        this.is_show_renwu = type;
        this.renwu_show = !this.renwu_show
      }


    },
    //消息弹出
    message() {
      var _this = this;
      _this.$api.doRequest("get", "api/egg_broadcast_list", {}, false).then(res => {
        _this.message_list = res.data.data;
        var count = res.data.data;
        this.donghua.message_list = true
        setInterval(function () {
          _this.message_index = _this.message_index + 1;
          if (count.length <= _this.message_index) {
            _this.message_index = 0
          }
        }, 3000)
      })
    },
    //摸摸鸡头
    set_motou() {
      var ji_info = this.ji_info;
      var _this = this;
      if (ji_info.chicken_info.emotion_value > 60) { //心情大于60的时候
        var num = _this.randomNum(0, 7)
        _this.tanchu_message(ji_info.huashu_gonglue.zjjcmmtxqdyls[num].content);
      } else { //心情小于60
        if (ji_info.chicken_info.self_is_momotou == 1) { //摸过鸡头
          if (ji_info.jinshi_info.is_over == 1) { //未进食的小鸡
            _this.tanchu_message(ji_info.huashu_gonglue.zjjcmmtycffjszxqxydyls[0].content);
          } else { //进食的小鸡
            _this.tanchu_message(ji_info.huashu_gonglue.zjjcmmtycfjszxqxydyls[0].content);
          }
        } else { //没有摸过鸡头
          _this.tanchu_message(ji_info.huashu_gonglue.zjjcmmtwchxqxylsdyls[0].content);
        }
      }
      if (ji_info.chicken_info.self_is_momotou == 0) {
        this.momo_jitou()
      }


    },
    randomNum(minNum, maxNum) {
      switch (arguments.length) {
        case 1:
          return parseInt(Math.random() * minNum + 1, 10);
          break;
        case 2:
          return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
          break;
        default:
          return 0;
          break;
      }
    },
    //获取话术
    get_message() {

    },
    //领取鸡蛋
    jiwu() {
      var _this = this;
      if (_this.ji_info.chicken_info.basket_eggs < 1) {
        _this.tanchu_message(_this.ji_info.huashu_gonglue.zjjcqjdbkq[0].content)
      } else {
        _this.donghua.jidan = true
        _this.tanchu_message(_this.ji_info.huashu_gonglue.zjjcqjdkq[0].content)
        var data = {}
        setTimeout(function () {
          _this.donghua.jidan = false;
        }, 2000)
        _this.$api.doRequest("get", 'api/basket_eggs_lingqu', data, false).then(res => {
          _this.get_ji()
        })
      }

    },
    //获取鸡的状态，心情，当前行为,为食
    get_ji() {
      this.style = true
      var _this = this;
      _this.$api.doRequest("get", "api/chicken_info", {}, false).then(res => {
        _this.is_ji_gif = false
        _this.ji_info = res.data.data;
        _this.percent = res.data.data.chicken_info.fodder / 500 * 100;
        if (_this.diandianle_message) {
          uni.showToast({
            title: _this.diandianle_message,
            icon: "none"
          })
          _this.diandianle_message = ""
        }
        clearTimeout(_this.dingshi_message)
        if (_this.ji_info.jinshi_info.is_over == 1) {

          _this.donghua.fanpen = false

          _this.dingshi_message = setInterval(function () {
            _this.tanchu_message(_this.ji_info.huashu_gonglue.zjjczdhzwljzzt[0].content)
          }, 10000)
        }
      })
    },
    //获取鸡蛋,未领取鸡蛋，已领取鸡蛋，生产中的鸡蛋
    get_jidan() {

    },
    //清理鸡粑粑
    del_ji_baba() {
      var _this = this;
      if (_this.donghua.chanshi) {
        uni.showToast({
          title: "操作过于频繁，请稍后再试！",
          icon: "none"
        })
        return false
      }
      _this.donghua.chanshi = true;
      _this.donghua.baba = true;
      var data = {
        action_type: 1
      }
      setTimeout(function () {
        _this.$api.doRequest("post", 'api/self_mmtqljf_add_emotion', data, false).then(res => {
          _this.get_ji()
        })
      }, 3000)

    },
    //摸摸鸡头
    momo_jitou() {
      var _this = this;
      var data = {
        action_type: 0
      }
      _this.$api.doRequest("post", 'api/self_mmtqljf_add_emotion', data, false).then(res => {
        _this.get_ji()
      })
    },
    //给鸡喂食
    add_jishi() {
      var _this = this;
      _this.$api.doRequest("get", "api/feed_the_chicken", {}, false).then(res => {
        _this.get_ji()
      })
    },
    //换鸡蛋
    huanjidan() {
      clearTimeout(this.tongbu_ji_status)
      uni.redirectTo({
        url: "/yangji/duihuan/index"
      })
    },
    //喂饲料动画
    weisiliao() {
      var _this = this;
      var ji_info = this.ji_info;
      if (ji_info.jinshi_info.is_over == 0) {
        _this.tanchu_message(_this.ji_info.huashu_gonglue.zjjcwszyws[0].content);
        return false;
      } else if (ji_info.chicken_info.fodder < 60) {
        uni.showToast({
          title: "饲料不足",
          icon: "none"
        })
        return false;
      } else {
        if (ji_info.chicken_info.fodder >= 60) {
          _this.tanchu_message(_this.ji_info.huashu_gonglue.zjjcwssldyls[0].content)
        } else {
          _this.tanchu_message(_this.ji_info.huashu_gonglue.zjjcwsslxyls[0].content)
        }
      }
      _this.donghua.jishi = true;
      setTimeout(function () {
        _this.donghua.jishi = false;
        _this.donghua.fanpen = true;
        setTimeout(function () {
          _this.ji_info.jinshi_info.is_over = false;
          _this.add_jishi(); //执行接口
        }, 300)
      }, 1000)
    },
    //小鸡说话
    tanchu_message(message) {
      var _this = this;
      if (!_this.donghua.message) {
        _this.donghua.message = true;
        _this.t_message = message;
        setTimeout(function () {
          _this.donghua.message = false;
        }, 2000)
      }
    },
    //一分钟同步一下
    tongbu_ji() {
      var _this = this;
      _this.tongbu_ji_status = setInterval(function () {
        _this.get_ji();
      }, 60000)
    },
    // 获取好友列表
    get_user_list() {
      var _this = this;
      _this.$api.doRequest("get", "api/chicken_friend_list2").then(res => {
        _this.donghua.user_list = true;
        _this.user_list = res.data.data
      })
    },
    //去他人鸡场
    to_userjichang(index) {
      clearTimeout(this.tongbu_ji_status)
      var item = this.user_list.friend_list[index];
      var userinfo = JSON.stringify(item);
      uni.redirectTo({
        url: "../userjichang/index?user_info=" + userinfo
      })
    },
    //获取任务配置信息
    get_renwu_cofing() {

      var _this = this;
      _this.$api.doRequest("get", "api/fodder_status_info2", {}, false).then(res => {
        res = res.data;
        if (res.code == 200) {
          res = res.data;
          var renwu_list = [{
            icon: 'https://wechat-pictures-1301970825.file.myqcloud.com/yangji/qiandao (2).png',
            name: "今日签到"
          },
            {icon: "https://wechat-pictures-1301970825.file.myqcloud.com/yangji/kanshipin.png", name: "看视频"},
            {icon: "https://wechat-pictures-1301970825.file.myqcloud.com/yangji/diandianle.png", name: "点点乐"},
            {icon: "https://wechat-pictures-1301970825.file.myqcloud.com/yangji/bangzhutaren.png", name: "帮助他人"}];
          renwu_list[0].name = renwu_list[0].name + res.qiandao_fodder + 'g';
          renwu_list[1].name = renwu_list[1].name + res.video_fodder + 'g';
          renwu_list[2].name = renwu_list[2].name + res.diandianle_fodder + 'g';
          renwu_list[3].name = renwu_list[3].name + res.help_other_fodder + 'g';

          renwu_list[0].status = res.qiandao_fodder;
          renwu_list[1].status = res.video_fodder;
          renwu_list[2].status = res.diandianle_fodder;
          renwu_list[3].status = res.help_other_fodder;
          if (res.is_today_qiandao == 0) {
            renwu_list[0].is_show = true;
          }
          if (res.video_scan_nums < res.video_scan_limit) {
            renwu_list[1].is_show = true;
            renwu_list[1].msg = res.video_scan_nums + '/' + res.video_scan_limit;
          }
          if (res.is_today_diandianle == 0) {
            renwu_list[2].is_show = true;
          }
          if (res.help_other_nums < res.help_other_limit) {
            renwu_list[3].is_show = true;
            renwu_list[3].msg = res.help_other_nums + '/' + res.help_other_limit;
          }
          _this.renwu_list = renwu_list
        }
      })
    },
    qiandao() {
      var _this = this;
      _this.$api.doRequest("get", 'api/qiandao_get_fodder2', {}).then(res => {
        if (res.data.code == 200) {
          uni.showToast({
            title: "签到成功"
          })
          _this.renwu_list[0].is_show = false;
          _this.get_ji()
        }
      })
    },
    renwu(index) {
      clearTimeout(this.tongbu_ji_status)
      if (index == 1) {
        this.$fromDd.type = 2
        uni.switchTab({
          url: "/pages/sindex/index?type=1"
        })
      } else if (index == 3) {
        this.renwu_show = false;
        this.get_user_list();
      }
    },
    yindao() {
      var index = this.yindao_index;
      index = index + 1;
      console.log(index)
      var z_index_arr = this.yindao_z_index;
      var l = z_index_arr.length;
      console.log(l);
      for (let i = 0; i < l; i++) {
        console.log(i, index)
        z_index_arr[i] = 1;
        if (i == index) {
          z_index_arr[i] = 11
        }
      }
      this.yindao_z_index = z_index_arr;
      this.yindao_index = index;
      if (index >= 5) {
        this.donghua.yindao = false;
        this.yindao_index = -1;
        uni.setStorageSync("yangji_yindao", true);
      }

    },
    //道具--使用加速卡
    daoju() {
      // this.donghua.daoju=false;
      if (!this.jiasuka_status) {
        uni.showToast({
          title: "操作过于频繁，请稍后再试！",
          icon: "none"
        })
        return false
      } else {
        this.jiasuka_status = false;
        var data = {}
        var _this = this;
        _this.$api.doRequest("get", "api/speed_card_use").then(res => {
          setTimeout(function () {
            _this.jiasuka_status = true;
          }, 2000)

          if (res.data.code == 200) {
            uni.showToast({
              title: res.data.msg
            })
            _this.get_ji()
          }
        })
      }

    },
    to(url) {
      clearTimeout(this.tongbu_ji_status)
      uni.redirectTo({
        url: url
      })
    },
    fanhui() {
      clearTimeout(this.tongbu_ji_status)
      uni.switchTab({
        url: "/pages/fuli/index"
      })
    }
  },
  onHide() {
    // uni.redirectTo({
    // 	url:"../show/index"
    // })
    uni.switchTab({
      url: "/pages/fuli/index"
    })
  },

}
</script>

<style>
@import "/yangji/static/yangji.css";
</style>
